package cn.xzq.cstm.service;

import java.util.List;

import cn.xzq.cstm.dao.CustomerDao;
import cn.xzq.cstm.domain.Customer;
import cn.xzq.cstm.domain.PageBean;

/**
 * 业务层
 * @author XC947
 *
 */
public class CustomerService {
	//依赖CustomerDao
	private CustomerDao customerDao = new CustomerDao();
	
	/**
	 * 添加客户
	 * @param customer
	 */
	public void add(Customer customer){
		customerDao.add(customer);
	}
	
	/**
	 * 查询所有客户
	 * @param customer
	 */
	public List<Customer> findAll(){
		return customerDao.findAll();
	}
	
	/**
	 * 查询所有客户-分页
	 * @param customer
	 */
	public PageBean<Customer> findAll(int currPageCode, int pageSize){
		return customerDao.findAll(currPageCode, pageSize);
	}
	
	/**
	 * 根据id查询一个客户
	 * @param customer
	 */
	public Customer findById(String cid){
		return customerDao.findById(cid);
	}
	
	
	/**
	 * 修改客户信息
	 * @param customer
	 */
	public void update(Customer customer){
		customerDao.update(customer);
	}
	
	/**
	 * 根据id删除客户
	 * @param cid
	 */
	public void deleteById(String cid){
		customerDao.deleteById(cid);
	}
	
	
	/**
	 * 多条件查询
	 * @param cid
	 */
	public PageBean<Customer> query(Customer customer, int currPageCode, int pageSize){
		//System.out.println(customer);
		return customerDao.query(customer, currPageCode, pageSize);
		
	}
}
